
import os
import shutil


def copy(sourceDir, targetDir):

    if not os.path.isdir(sourceDir):
        print("sourceDir is not exist")
        return 0
    if os.path.isdir(targetDir):
        print("targetDir is exist,please confirm")
        return 0

    shutil.copytree(sourceDir, targetDir)
    if not os.path.isdir(targetDir):
        print("copy is defeated")
    else:
        print("copy is success")

    # shutil.copyfile()


sPath = "G:\Program Files\py"
tPath = "G:\Program Files\py2"
copy(sPath, tPath)

"""
不把源和目的写死，实现类似Linux cp命令试下
"""
